<?php

/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2022/10/25 13:50
 * Desc:字节配置信息
 */
class Controller_Pc_Api_V2_Toutiao_Config extends Controller_Pc_Api_V2_Base
{

    //评论api控制器
    public function before()
    {
        parent::before();
        $token       = Common::remove_xss($this->request_data->token);
        $check_token = Model_Api_V2_Pub::token_decode($token);
        $this->mid   = $check_token['status'] ? $check_token['mid'] : '';
    }

    /**
     * 获取抖音配置信息
     * @date 2023/3/29 0029
     * @author gl
     */
    public function action_index()
    {
        $fields = array('cfg_toutiao_open_customer_service','cfg_toutiao_service_certificate','cfg_toutiao_customer_id','cfg_toutiao_service_company');
        $config = Model_Sysconfig::get_configs(0, $fields);
        if($config['cfg_toutiao_service_certificate']){
            $config['cfg_toutiao_service_certificate'] = explode(',',$config['cfg_toutiao_service_certificate']);
            foreach ($config['cfg_toutiao_service_certificate'] as &$item){
                $item = Model_Api_V2_System::uniapp_img($item);
            }
        }
        
        $result = array(
            'status' => true,
            'data' => $config,
        );
        $this->send_datagrams($this->client_info['id'], $result, $this->client_info['secret_key']);
    }
}